package com.zero.zerocat;

import com.zero.servlet.ZeroRequest;
import com.zero.servlet.ZeroResponse;
import com.zero.servlet.ZeroServlet;

/**
 * ZeroCat中对Servlet规范的默认实现
 * 要注意的是，我们写的ZeroCat不能放在中文路径下，因为
 */
public class DefaultZeroServlet extends ZeroServlet {

    @Override
    public void doGet(ZeroRequest request, ZeroResponse response) throws Exception {
        String uri = request.getUri();
        response.write("404-no this servlet: " + (uri.contains("?") ? uri.substring(0, uri.lastIndexOf("?")) : uri));
    }

    @Override
    public void doPost(ZeroRequest request, ZeroResponse response) throws Exception {
        doGet(request, response);
    }
}
